home *** CD-ROM | disk | FTP | other *** search
- /* Mail.rexx v1.00 - by Rick Taylor, 9-26-94 */
- /* v1.01 - 9-30-94 */
- /* v1.02 - 10-1-94 */
- options results
- address command
-
- /* Some initializations... */
-
- lf = '0a'x
- cr = '0d'x
- MailFile = ""
- CodeFlag = ""
- passed = ARG(1)
- parse var passed whoto MailFile CodeFlag . rest .
- if MailFile = "" then CodeFlag = ""
-
- if whoto = "" then do
- say "USAGE: First alias MAIL rx drexxmail:mail.rexx"
- say " Then use the following template..."
- say " "
- say "MAIL <user@host[,user@host,user@host,...]> [<filename>] [u]"
- say " "
- exit
- end
-
- if exists('T:mailrexx.mail') then 'delete T:mailrexx.mail QUIET'
-
- /* Prepare the mail file */
-
- if MailFile ~= "" then do
- 'copy' MailFile "T:mailrexx.mail QUIET"
- if CodeFlag = "u" then do
- call open ecommand, "T:mailrexx.cmd",write
- call writeln ecommand, 'uuxt <NIL: >NIL: a t:mailrexx.mail 'MailFile
- call close ecommand
- 'execute' "T:mailrexx.cmd"
- say "Sending binary file UUencoded..."
- end
- else say "Sending plain text file..."
- end
- else do
- say "Type your message below. Use a single period on a line by"
- say "itself to end the message."
- say "----------------------------------------------------------"
- say " "
- call open mf, "T:mailrexx.mail",write
- msglin = ""
- do until msglin = "."
- call writeln mf,msglin
- parse pull msglin
- end
- call close mf
- end
-
- /* Subject? */
-
- if CodeFlag = "u" then mailsub = "UUencoded file - "||MailFile
- else do
- say "Enter a subject for this mail:"
- parse pull mailsub
- end
- if mailsub = "" then mailsub = "No subject given - plain text message"
-
- /* We need to make a mail file with headers + signature for sendmail.rexx */
-
- call open hdr,"T:mailrexx.hdr",write
- call writeln hdr, 'To: ' whoto
- call writeln hdr, 'Subject:' mailsub
- call writeln hdr, 'X-Mailer: DREXXMAIL Mailer CLI Version 1.02 (October 1 1994)'
- call close hdr
-
- sigfile = ""
- if CodeFlag ~= "u" then sigfile = envar('DRMSIGNATURE')
-
- 'join T:mailrexx.hdr T:mailrexx.mail' sigfile 'AS T:mmessage'
- 'delete T:mailrexx.hdr QUIET'
- 'delete T:mailrexx.mail QUIET'
-
- /* Mail file is made, so let's send the message with sendmail.rexx */
- say "Sending..."
- 'rx drexxmail:sendmail.rexx t:mmessage'
- 'delete T:mmessage QUIET'
-
- /* We're outta here */
-
- msg = "Sent!"||lf||"To: "||whoto||lf||"Subject: "||mailsub||lf
- say msg
- exit
-
- envar: procedure
- arg evname
- epath = "ENV:"||evname
- evalue = ""
- if exists(epath) then do
- call open .envar,epath,read
- evalue = readln(.envar)
- call close .envar
- end
- return evalue
-